﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using SmartSpace.Core;

namespace SsTool.Base.Windows
{
    /// <summary>
    /// CreateRoleWindow.xaml 的交互逻辑
    /// </summary>
    public partial class CreateRoleWindow : Window
    {
        private Role _role;
        public CreateRoleWindow()
        {
            InitializeComponent();
            _role = new Role();
            _role.Id = Guid.NewGuid();

            this.DataContext = _role;
        }

        private void _ctlBtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            _role.CreatedTime = DateTime.Now;
            ICoreService service = App.Get<ICoreService>();
            if (service.StoreRole(_role))
            {
                DialogResult = true;
                return;
            }
            MessageBox.Show("保存失败!");
        }
    }
}
